package com.cfs.svcimpl.bz;

import java.util.List;

import com.cfs.dao.bz.DevisionDao;
import com.cfs.po.bz.Devision;
import com.cfs.svc.bz.DevisionService;
import com.cfs.vo.Condition;
import com.cfs.vo.Pager;

public class DevisionServiceImpl implements DevisionService {
	
	private DevisionDao dao;	
	

	public DevisionDao getDao() {
		return dao;
	}

	public void setDao(DevisionDao dao) {
		this.dao = dao;
	}

	public Long add(Devision d) {
		Long n = dao.insert(d);
		System.out.println("RETURN Devision NUM: " + n + " ID:" + d.getId() );
		return d.getId();
	}

	public int deleteById(Long id) {
		return dao.delete(id);
	}

	public Devision get(Long id) {
		return dao.get(id);
	}

	public List<Devision> list(Condition c) {
		return dao.list(c);
	}

	public List<Devision> listSub(Long pid, Pager p) {
		if(p!=null && p.getFirst()==null){
			p = null;
		}
		return dao.listSub(pid>=0 ? pid : null, p );
	}

	public Long update(Devision d) {
		return dao.update(d);
	}

}
